package net.apexes.demo.codegen.dslite.qvar;

import java.time.LocalDate;
import net.apexes.demo.codegen.dslite.entity.BusinessDay;
import net.apexes.demo.codegen.dslite.qvar.base.QEntityBase;
import net.wafo.dslite.core.info.Index;

import net.wafo.dslite.core.dsl.*;

/**
 * QBusinessDay is a DSLite query type for BusinessDay
 * @see BusinessDay
 */
public class QBusinessDay extends QEntityBase<BusinessDay> {

    public static final QBusinessDay $ = new QBusinessDay("BUSINESS_DAY");

    public final TemporalColumn<LocalDate> bizDate = date("BIZ_DATE").field("bizDate").notNull().build();

    public final StringColumn shopId = varchar("SHOP_ID", 22).field("shopId").notNull().build();

    public class Indexs {

        public final Index primaryKey6 = index("PRIMARY_KEY_6").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QBusinessDay(String tableName) {
        super(BusinessDay.class, tableName);
    }

    @Override
    public BusinessDay newEntity() {
        return new BusinessDay();
    }

    @Override
    public Object getFieldValue(BusinessDay entity, String fieldName) {
        switch (fieldName) {
            case "bizDate":
                return entity.getBizDate();
            case "shopId":
                return entity.getShopId();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(BusinessDay entity, String fieldName, Object value) {
        switch (fieldName) {
            case "bizDate":
                entity.setBizDate((java.time.LocalDate) value);
                break;
            case "shopId":
                entity.setShopId((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

